/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			langsupport.h
  \date			Jul 2011
  \author		TNick

  \brief		Contains the definition for LangSupport class


  Copyright (c) 2011, Nicu Tofan
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the copyright holder nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL NICU TOFAN BE LIABLE FOR ANY
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __LANGSUPPORT_INC__
#define __LANGSUPPORT_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

class		QMenu;
class		QAction;

#include	<QMenu>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */




/// class that groups language related issues for the application
/**
*	This is a "static" class, with all elements being static. There is no need
*	to instantiate this class.
*
*	The class makes use of QSettings and assumes that proper functions
*	(setOrganizationName, setOrganizationDomain, setApplicationName)
*	were used to create a proper context.
*
*	As it is intended to be reusable for various projects, the class should be
*	keept as generic as possible.
*/
class LangSupport 		{

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/// types of menus
	enum	MenuType	{
		USE_CURRENT = 0,
		USE_DEFAULT,
		LOAD_A_FILE,
		IN_DEF_LOC,
		RECENT_LOADED
	};

	/// if defined, new files are checked with a translator on load
//#define	LANG_CHECK_ON_LOAD		1

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:

	/// holds the path and full name for current file loaded (empty => default)
	static QString			s_from_stg;



	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:

	/// to be called before any widget is created to initialize te system
	/**
	  *	The function will read the settings and try to find the language
	  * to use. It is assumed that the default language is english.
	  */
	static void		appStart		(void);

	/// called to populate a menu with languages and related options
	/**
	  *	This is usualy called after some GUI elements were created to
	  * fill a menu with specific options and a list of languages.
	  * The user can load a language file, select one from the menu or
	  * revert to currently selected language.
	  */
	static void		populateMenu	(QMenu * to_manage);

	/// menu handler. called all the actions in the menu
	/**
	  *	It is the responsability of the owner to call this funtion.
	  */
	static void		menuHandler		(QMenu * to_manage, QAction * act_tigg);

	/// called before aplication (GUI) shutdown to save the options
	static void		saveOptions		(QMenu * to_manage);


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class LangSupport	*/

/*  CLASS    =============================================================== */
//
//
//
//
#endif // __LANGSUPPORT_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
